package com.atguigu.spring;

import com.atguigu.spring.bean.Cat;
import com.atguigu.spring.bean.Person;
import org.springframework.context.annotation.Import;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * bean1.xml 主要用于演示 xml的启动过程 以及属性设置流程
 * beans2.xml 为了演示 com.atguigu.spring.processor包下 后置处理器相关的生命周期; 因为要避免容器中有过多的其他组件, 而该配置只会加载一个cat组件和processor 方便观察
 */
//https://gitee.com/leifengyang/spring-framework
public class MainTest {

	public static void main(String[] args) {
		// beans2.xml 配置 是用于测试BeanFactoryPostProcessor、BeanPostProcessor的执行时机的
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("beans2.xml");
		// Person bean = context.getBean(Person.class);
		// System.out.println(bean);

		Cat cat = context.getBean(Cat.class);
		System.out.println(cat);
	}

	public static void test01(String[] args) throws IOException {
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
		Person bean = context.getBean(Person.class);
		System.out.println(bean);

	}
}
